package com.example.my_flea_street.Mapper;

import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

@Mapper
@Repository
public interface EditMapper {
    @Insert("insert into information(release_time,text,pic,category,user_id,key_word) values(#{release_time},#{text},#{pic},#{category}," +
            "#{user_id},#{key})")
    @Options(useGeneratedKeys = true)
    void addInfo(@Param("release_time") String release_time, @Param("text") String text, @Param("pic") String pic,
                 @Param("category") int category, @Param("user_id") int user_id, @Param("key") String key);

    @Update("update information set release_time=#{release_time},text=#{text},pic=#{pic}" +
            ",key_word=#{key} where id=#{id}")
    void editInfo(@Param("id") int id,@Param("release_time") String release_time, @Param("text") String text,
                  @Param("pic") String pic, @Param("key") String key);

    @Select("select pic from information where id=#{id}")
    String getPic(@Param("id") int id);
}
